import request from '@/utils/request'

// 查询项目账号信息列表
export function listAccount(query) {
  return request({
    url: '/cld/account/list',
    method: 'get',
    params: query
  })
}

// 根据项目ID查询项目账号信息列表
export function getAccountListByProjectId(projectId) {
  return request({
    url: '/cld/account/getProjectAccountListByProjectId/' + projectId,
    method: 'get'
  })
}

// 查询项目账号信息详细
export function getAccount(projectAccountId) {
  return request({
    url: '/cld/account/' + projectAccountId,
    method: 'get'
  })
}

// 新增项目账号信息
export function addAccount(data) {
  return request({
    url: '/cld/account',
    method: 'post',
    data: data
  })
}

// 修改项目账号信息
export function updateAccount(data) {
  return request({
    url: '/cld/account',
    method: 'put',
    data: data
  })
}
// 重置密码
export function resetPasswordAccount(projectAccountId, password) {
  const data = {
    projectAccountId,
    password
  }
  return request({
    url: '/cld/account/resetPwd',
    method: 'put',
    data: data
  })
}
// 删除项目账号信息
export function delAccount(projectAccountId) {
  return request({
    url: '/cld/account/' + projectAccountId,
    method: 'delete'
  })
}
